<template>
  <view style="max-height: 600px;">
    <cu-custom bgColor="bg-gradual-pink" :isBack="flase">
      <block slot="content">雷达信息设置</block>
       <text slot="left" @tap="backTo"><text class="cuIcon-back" style="margin-right: 6px;"></text>返回</text>
      <block slot="right">
        <view style="margin-right: 10px;" @tap="flash()"><text class='cuIcon-refresh '>刷新</text></view>
          <view @tap="showAll = !showAll" >
            <text v-if="showAll">收起</text>
            <text v-else>展开</text>
          </view>
        </block>
    </cu-custom>
    <form>
      <view class="cu-form-group1">
          <view class="title">雷达IP设置：</view>
          <input class="input1"  v-model="radarIP"  placeholder="请输入IP地址" name="input" type="text"></input>
          <view class="setbtn_box">
            <button class="sure_btn1  margin-tb-sm sm "  @tap="cancel1">
              取消
          </button>
            <button class="sure_btn1 bg-blue margin-tb-sm sm "  @tap="setIP">
              应用
          </button>
          </view>
      </view>
       <view class="cu-form-group1">
          <view class="title">雷达名称设置：</view>
          <input class="input1" v-model="radarName"  placeholder="请输入雷达名称" name="input"  ></input>
              <view class="setbtn_box">
            <button class="sure_btn1  margin-tb-sm sm "  @tap="cancel2">
              取消
          </button>
            <button class="sure_btn1 bg-blue margin-tb-sm sm "  @tap="setName">
              应用
          </button>
          </view>
      </view>
    </form>
    
    <!-- 雷达信息相关设置 -->
    <!-- 1.GPS和朝向 -->
    <view class="s_box cant_box"  style="padding-top: 20px;">
      <view class="title">1.GPS和朝向</view>
       <view  class="cuIcon-right open1" :style="{ transform: show1 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show1 = !show1"></view>
      <form v-show="show1">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">纬度：</view>
                <input class="input1" v-model="quaryForm1.Latitude"  type="number"  placeholder="" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">经度：</view>
                <input class="input1" v-model="quaryForm1.Longitude" type="number"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">海拔高度：</view>
                <input class="input1" v-model="quaryForm1.Altitude" type="number"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">朝向（偏北角）:</view>
                <input class="input1" v-model="quaryForm1.Orientation" type="number"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
        <view class="btn_box">
           <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
              刷新
          </button> -->
          <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm1,'GPS和朝向',1)">
              应用
          </button>
        </view>
    </view>
    <!-- 2.全局参数 -->
    <view class="s_box cant_box">
      <view class="title">2.全局参数</view>
      <view  class="cuIcon-right open1" :style="{ transform: show2 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show2 = !show2"></view>
      <form v-show="show2">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">距离误差：</view>
                <input class="input1" v-model="quaryForm2.RangeError" type="number"  placeholder="单位：m" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">系统误差：</view>
                <input class="input1" v-model="quaryForm2.SystemError" type="number"   placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">机动波门：</view>
                <input class="input1"  v-model="quaryForm2.WaveGate" type="number"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">稳定航迹残留时间:</view>
                <input class="input1"  v-model="quaryForm2.TrackTime" type="number" placeholder="单位：s" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
       <view class="btn_box">
           <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
              刷新
          </button> -->
          <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm2,'全局参数',2)">
              应用
          </button>
        </view>

    </view>
    <!-- 3.起批参数 -->
    <view class="s_box cant_box">
      <view class="title">3.起批参数</view>
       <view  class="cuIcon-right open1" :style="{ transform: show3 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show3 = !show3"></view>
      <form v-show="show3">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">航迹起批点数：</view>
                <input class="input1"  v-model="quaryForm3.OnBatchNum" type="number" placeholder="单位：个" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">航迹起批难度：</view>
                <input class="input1" v-model="quaryForm3.OnBatchDifficulty" type="number"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">点迹距离分裂波门:</view>
                <input class="input1" v-model="quaryForm3.PlotRange" type="number"  placeholder="单位：m" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">航迹距离分裂波门:</view>
                <input class="input1" v-model="quaryForm3.TrackRange" type="number"  placeholder="单位：m" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
         <view class="btn_box">
           <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
              刷新
          </button> -->
          <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm3,'起批参数',3)">
              应用
          </button>
        </view>
    
    </view>
     <!-- 4.跟踪限制 -->
    <view class="s_box cant_box">
      <view class="title">4.跟踪限制</view>
       <view  class="cuIcon-right open1" :style="{ transform: show4 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show4 = !show4"></view>
      <form v-show="show4">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">跟踪高速限制：</view>
                <input class="input1"  v-model="quaryForm4.HighSpeedLimit" type="number"  placeholder="单位：m/s" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">跟踪低速限制：</view>
                <input class="input1" v-model="quaryForm4.LowSpeedLimit" type="number"  placeholder="单位：m/s" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">跟踪高度上限：</view>
                <input class="input1"  v-model="quaryForm4.UpperLimitHeigth" type="number" placeholder="单位：m" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">跟踪高度下限:</view>
                <input class="input1"v-model="quaryForm4.MinimumHeigth" type="number"  placeholder="单位：m" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
           <view class="btn_box">
           <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
              刷新
          </button> -->
          <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm4,'跟踪限制',4)">
              应用
          </button>
        </view>
     
    </view>
    <!-- 5.输出周期 -->
    <view class="s_box cant_box">
      <view class="title">5.输出周期</view>
      <view  class="cuIcon-right open1" :style="{ transform: show5 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show5 = !show5"></view>
      <form v-show="show5">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">航迹输出周期：</view>
                <input class="input1" v-model="quaryForm5.TarckOutCycle" type="number"  placeholder="单位：ms" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">点迹输出周期：</view>
                <input class="input1"  v-model="quaryForm5.PlotOutCycle" type="number" min="100" max="5000"  placeholder="范围：100~5000，单位：ms" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">凝聚前点迹输出周期:</view>
                <input class="input1"  v-model="quaryForm5.PrePlotOutCycle" type="number" min="100" max="5000" placeholder="范围：100~5000，单位：ms" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
          <view class="btn_box">
            <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
                刷新
            </button> -->
            <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm5,'输出周期',5)">
                应用
            </button>
        </view>
    </view>
    <!-- 6.数据开关 -->
    <view class="s_box cant_box">
      <view class="title">6.数据开关</view>
      <view  class="cuIcon-right open1" :style="{ transform: show6 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show6 = !show6"></view>
      <form v-show="show6">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">航迹上报开关：</view>
                <!-- <input class="input1" v-model="quaryForm6.SwitchTrack"  placeholder="" name="input"></input> -->
                  <uni-data-select
                    v-model="quaryForm6.SwitchTrack"
                    :localdata="list1"
                    aria-placeholder="请选择"
                  ></uni-data-select>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">点迹上报开关：</view>
                <!-- <input class="input1" v-model="quaryForm6.SwitchPlot"  placeholder="" name="input"></input> -->
                  <uni-data-select
                    v-model="quaryForm6.SwitchPlot"
                    :localdata="list1"
                    aria-placeholder="请选择"
                  ></uni-data-select>
              </view>
            </u-row>
          </view>
         
            <!-- <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">其它类型信息上报:</view>
                  <uni-data-select
                    v-model="quaryForm6.SwitchOther"
                    :localdata="list2"
                    aria-placeholder="请选择"
                  ></uni-data-select>
                  </view>
                </u-row>
              </view> -->
            <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">凝聚前点迹上报开关:</view>
                <!-- <input class="input1" v-model="quaryForm6.SwitchOther"  placeholder="" name="input"></input> -->
                  <uni-data-select
                    v-model="quaryForm6.SwitchPreplot"
                    :localdata="list1"
                    aria-placeholder="请选择"
                  ></uni-data-select>
              </view>
            </u-row>
          </view>
		  </form>
        <view class="btn_box">
            <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
                刷新
            </button> -->
            <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm6,'数据开关',6)">
                应用
            </button>
        </view>

    </view>
    <!-- 7.门限参数 -->
    <view class="s_box cant_box">
      <view class="title">7.门限参数</view>
      <view  class="cuIcon-right open1" :style="{ transform: show7 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show7 = !show7"></view>
      <form v-show="show7">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">检测门限：</view>
                <input class="input1" v-model="quaryForm7.DtThd" type="number" placeholder="单位：dB" name="input"></input>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">检测高速门限：</view>
                <input class="input1" v-model="quaryForm7.DtThdHigh" type="number"  placeholder="单位：m/s" name="input"></input>
              </view>
            </u-row>
          </view>
           <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">检测低速门限:</view>
                <input class="input1" v-model="quaryForm7.DtThdLow" type="number" placeholder="单位：m/s" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
           <view class="btn_box">
            <!-- <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
                刷新
            </button> -->
            <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="commitQuery(quaryForm7,'门限参数',7)">
                应用
            </button>
        </view>
    </view>
     <!-- 8.校时参数 -->
    <!-- <view class="s_box cant_box">
      <view class="title">8.校时参数</view>
      <view  class="cuIcon-right open1" :style="{ transform: show8 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show8 = !show8"></view>
      <form v-show="show8"> -->
          <!-- <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">校时开关：</view>
                  <uni-data-select
                    title=" "
                    v-model="quaryForm8.TimingParameters"
                    :localdata="list2"
                    aria-placeholder="请选择"
                  ></uni-data-select>
             </div>
            </u-row>
          </view> -->
          <!-- <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">校时时间：</view>
                <input class="input1" v-model="quaryForm8.TimeParam"   @tap="showDatePicker = true" placeholder="yyyy-MM-dd hh:mm:ss" name="input"></input>
                  <mx-date-picker
                    :show="showDatePicker"
                    type="datetime"
                    :value="quaryForm8.TimeParam"
                    :show-tips="true"
                    :show-seconds="true"
                    @confirm="onConfirm"
                    @cancel="showDatePicker =false"
                  />
              </view>
            </u-row>
          </view> -->
		  <!-- </form>
         <view class="btn_box">
            <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
                刷新
            </button>
            <button class="sure_btn bg-blue margin-tb-sm sm " @tap="commitQuery(quaryForm8,'校时参数',8)">
                应用
            </button>
        </view>
    </view> -->
    <!-- 9.跟踪模式 -->
    <!-- <view class="s_box cant_box">
      <view class="title">9.跟踪模式</view>
      <view  class="cuIcon-right open1" :style="{ transform: show9 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show9 = !show9"></view>
      <form v-show="show9">
          <view class="form_item">
             <u-row customStyle="margin-bottom: 10px">
              <div class="box1">
                <view class="sub_title">跟踪开关：</view>
                 <uni-data-select
                    v-model="quaryForm8.Switch"
                    :localdata="list4"
                    aria-placeholder="请选择"
                  ></uni-data-select>
             </div>
            </u-row>
          </view>
          <view class="form_item">
            <u-row customStyle="margin-bottom: 10px">
              <view class="box2">
                <view class="sub_title">GUID号：</view>
                <input class="input1" v-model="quaryForm8.GUID"  placeholder="" name="input"></input>
              </view>
            </u-row>
          </view>
		  </form>
           <view class="btn_box">
            <button class="sure_btn bg-blue margin-tb-sm sm "  @tap="flash(quaryForm1,'GPS和朝向',1)">
                刷新
            </button>
            <button class="sure_btn bg-blue margin-tb-sm sm " @tap="commitQuery(quaryForm9,'跟踪模式',9)">
                应用
            </button>
        </view>
    </view> -->
    <!-- 10.BIT状态 -->
    <view class="s_box cant_box">
      <view class="title">8.BIT状态</view>
       <view  class="cuIcon-right open1" :style="{ transform: show10 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show10 = !show10"></view>
      <view class="content_box" v-show="show10">
        <view class="item">接受通道状态：<text class="text">{{ info.ReveStatus || '未知' }}</text></view>
        <view class="item">发射通道状态： <text class="text">{{ info.TranStatus || '未知' }}</text></view>
        <!-- <view class="item">更新状态： <text class="text">{{ info.UpdateStatus || '' }}</text></view> -->
      </view>
    </view>
  
    <!-- 12.固件编号 -->
    <view class="s_box cant_box">
      <view class="title">9.固件编号</view>
          <view  class="cuIcon-right open1" :style="{ transform: show12 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show12 = !show12"></view>
      <view class="content_box" v-show="show12">
        <view class="item">A9版本号:<text class="text">{{ info.Version_A9 || '未知' }}</text></view>
        <view class="item">ARM版本号： <text class="text">{{ info.Version_ARM || '未知' }}</text></view>
        <view class="item">DP版本号： <text class="text">{{ info.Version_SS || '未知' }}</text></view>
        <view class="item">A5版本号： <text class="text">{{ info.Version_A5 || '未知' }}</text></view>
        <view class="item">SP版本号： <text class="text">{{ info.Version_SP || '未知' }}</text></view>
      </view>
    </view>
    <!-- 13.工作状态 -->
    <!-- <view class="s_box cant_box">
      <view class="title">13.工作状态</view>
           <view  class="cuIcon-right open1" :style="{ transform: show13 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show13 = !show13"></view>
      <view class="content_box" v-show="show13">
        <view class="item">接收增益:<text class="text">{{ info.RecvGain || '未知' }}</text></view>
        <view class="item">发射增益： <text class="text">{{ info.TranGain || '未知' }}</text></view>
        <view class="item">接收幅度： <text class="text">{{ info.RecvAmplitude || '未知' }}</text></view>
        <view class="item">发射幅度： <text class="text">{{ info.TranAmplitude || '未知' }}</text></view>
      </view>
    </view> -->
    <!-- 14.产品型号 -->
    <view class="s_box cant_box"  >
      <view class="title">10.产品型号</view>
      <view  class="cuIcon-right open1" :style="{ transform: show14 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show14 = !show14"></view>
      <view class="content_box" v-show="show14">
        <view class="item" style="width: 48%">设备位置用途码:<text class="text">{{ info.Area || '未知' }}</text></view>
        <view class="item" style="width: 48%">阵面代码： <text class="text">{{ info.Area_1 || '未知' }}</text></view>
        <view class="item" style="width: 48%">控制箱配置码： <text class="text">{{ info.Area_3 || '未知' }}</text></view>
        <view class="item" style="width: 48%">阵面数量及配置码： <text class="text">{{ info.Area_2 || '未知' }}</text></view>
        <view class="item" style="width: 48%">软件参数配置码： <text class="text">{{ info.Area_4 || '未知' }}</text></view>
      </view>
    </view>
      <!-- 11.工作参数 -->
    <view class="s_box cant_box">
      <view class="title">11.工作参数</view>
      <view  class="cuIcon-right open1" :style="{ transform: show11 ? 'rotate(0deg)' : 'rotate(90deg)' }" @tap="show11 = !show11"></view>
      <view class="content_box" v-show="show11">
        <view class="item">工作模式<text class="text">{{ info.Mode || '未知' }}</text></view>
        <view class="item">工作频点： <text class="text">{{ info.Frequency || '未知' }}</text></view>
        <view class="item">阵面类型： <text class="text">{{ info.FrontType || '未知' }}</text></view>
        <view class="item">功率衰减： <text class="text">{{ info.PowerAttenuation || '未知' }}</text></view>
        <view class="item">阵面同步： <text class="text">{{ info.FrontSynch || '未知' }}</text></view>
        <view class="item">时钟源： <text class="text">{{ info.ClockSource || '未知' }}</text></view>
      </view>
    </view>
    <!-- 雷达信息应用弹窗 -->
    <view
      class="cu-modal msgDialog"
      :class="modalName == 'DialogModal1' ? 'show' : ''"
    >
      <view class="cu-dialog">
        <view class="cu-bar bg-title justify-end">
          <view class="content">提示</view>
          <view class="action" @tap="modalName = null">
            <text
              class="cuIcon-close text-white"
              style="font-weight: 700"
            ></text>
          </view>
        </view>
        <view class="padding-xl">
          <!-- Modal 内容。 -->
          <text>确认修改【{{ msg }}】信息吗？</text>
        </view>
        <view class="cu-bar bg-white justify-center">
          <view class="action">
            <button class="cu-btn bg-red" @tap="modalName = null">取消</button>
            <button class="cu-btn bg-blue margin-left" @tap="sureChange">
              确定
            </button>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
// import UniDataSelect from "@/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue";
import apiService from '@/api/api.js'
import uRow from 'uview-ui/components/u-row/u-row.vue'
import UniDataSelect from "@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue";
import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
export default {
  name:'UserSet',
  components: {
    UniDataSelect,uRow,UniDataSelect,MxDatePicker
  },
  data() {
    return {
      ipFlag:true,
      modalName: null,
      msg:'',
      showDatePicker: false,
      radarIP:'192.168.0.182',
      radarName:'雷达1',
      list1: [
        {
          value:'1',
          text:'允许上报'
        },
        {
          value:'0',
          text:'禁止上报'
        }
      ],
      list2: [
           {
          value:'1',
          text:'开'
        },
        {
          value:'0',
          text:'关'
        }
      ],
      list3: [
           {
          value:'1',
          text:'手动校时'
        },
        {
          value:'0',
          text:'不校时'
        },
         {
          value:'2',
          text:'网络校时，NTP'
        }
      ],
      list4: [
        {
          value:'1',
          text:'跟踪模式'
        },
        {
          value:'0',
          text:'搜索模式'
        }
      ],
      showAll:true,
      show1:true,
      show2:true,
      show3:true,
      show4:true,
      show5:true,
      show6:true,
      show7:true,
      show8:true,
      show9:true,
      show10:true,
      show11:true,
      show12:true,
      show13:true,
      show14:true,
      switchC: true,
      modelLocalData: [],
      quaryForm1: {
        Latitude:'',
        Longitude:'',
        Altitude:'',
        Orientation:'',
      },
      quaryForm2: {
        RangeError:'',
        SystemError:'',
        WaveGate:'',
        TrackTime:'',
      },
      quaryForm3: {
        OnBatchNum:'',
        OnBatchDifficulty:'',
        PlotRange:'',
        TrackRange:'',
      },
      quaryForm4: {
        HighSpeedLimit:'',
        LowSpeedLimit:'',
        UpperLimitHeigth:'',
        MinimumHeigth:'',
      },
      quaryForm5: {
        TarckOutCycle:'',
        PlotOutCycle:'',
        PrePlotOutCycle:'',
      },
      quaryForm6: {
        SwitchTrack:'',
        SwitchPlot:'',
        SwitchPreplot:'',
        SwitchOther:'',
      },
      quaryForm7: {
        DtThd :'',
        DtThdHigh:'',
        DtThdLow:''
      },
      quaryForm8: {
        TimingParameters:'',
        TimeParam:'',
      },
      quaryForm9: {
        Switch:'',
        GUID:''
      },
      paramsObj:{},
      token: null,
      num: null,
      info: {
        ReveStatus:'',
        TranStatus:'',
        UpdateStatus: '',
        Mode:'',
        Frequency:'',
        FrontType:'',
        PowerAttenuation:'',
        FrontSynch:'',
        ClockSource: '',
        Version_A9:'',
        Version_ARM:'',
        Version_SS:'',
        Version_A5:'',
        Version_SP: '',
        RecvGain:'',
        TranGain:'',
        RecvAmplitude:'',
        TranAmplitude: '',
        Area:'',
        Area_1:'',
        Area_2:'',
        Area_3:'',
        Area_4:'',
      }
    };
  },
  created() {
    this.token = uni.getStorageSync('Access-Token') || null
    this.radarName = uni.getStorageSync('radarName') ||  this.radarName 
    this.radarIP = uni.getStorageSync('radarIP') ||  this.radarIP 
    this.ipFlag = uni.getStorageSync('ipFlag') 
    if (!(this.ipFlag =='ipFlag') && this.radarIP) {
      this.getDerviceMsg()
    }
  },
  watch: {
    showAll(newVal) {
          this.show1 = newVal
          this.show2 = newVal
          this.show3 = newVal
          this.show4 = newVal
          this.show5 = newVal
          this.show6 = newVal
          this.show7 = newVal
          this.show8 = newVal
          this.show9 = newVal
          this.show10 = newVal
          this.show11 = newVal
          this.show12 = newVal
          this.show13 = newVal
          this.show14 = newVal
    }
  },
  methods: {
    backTo() {
        this.$router.push({
          path: '/pages/index/index',
          query: { value: 'people' }  // 传递的参数值
        });
    },
    // 设置雷达IP
    setIP() {
       // 使用正则表达式验证IP地址的格式和长度
      let ipRegex = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/;
      if (ipRegex.test(this.radarIP)) {
        uni.setStorageSync('radarIP', this.radarIP)
        this.$tip.success('设置成功,请重新进入！');
        uni.removeStorageSync("Access-Token");
        uni.removeStorageSync('ipFlag')
        // 提示设置成功
        this.$tip.success('设置成功，请重新登录！');
        window.closeSocket = true
        // 使用 uni.reLaunch 方法跳转到登录页面
        setTimeout(() => {
          uni.reLaunch({
            url: '/pages/login/login'
        });
        }, 0);
        setTimeout(() => {
          window.location.reload();
        }, 0);
      } else {
        this.$tip.alert('请输入正确的IP地址');
         this.radarIP =''
      }
    },
    cancel1() {
      const ip = uni.getStorageSync('radarIP')
      if (ip) {
        this.radarIP = ip
      } else {
       this.radarIP = '192.168.0.182'
      }
     },
    setName() {
      if (this.radarName.length > 15) {
        this.$tip.alert('限制最大字符为15个');
        // this.radarName =''
        return
      }
       if (this.radarName) {
          uni.setStorageSync('radarName', this.radarName)
        this.$tip.success('设置成功！');
      } else {
        this.$tip.alert('请输入雷达名称');
      }
    },
    cancel2() {
      const radarName = uni.getStorageSync('radarName')
      if (radarName) {
        this.radarName = radarName
      } else {
       this.radarName = '雷达1'
      }
    },
    // 确认时间选择
    onConfirm(e) {
      this.showDatePicker = false
      if (e) {
         e.value = e.value.replaceAll(
            "/",
            "-"
          )
      }
        //选择的值
        this.quaryForm8.TimeParam=  e.value
    },
     getCurrentDate() {
				const currentDate = new Date();
				const year = currentDate.getFullYear();
				const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始，所以要加1
				const day = currentDate.getDate().toString().padStart(2, '0');
				return `${year}${month}${day}`;
			},
    // 获取雷达设备信息
    getDerviceMsg() {
      uni.showLoading({
				title: '加载中...',
				mask: true
      });
      let timer = this.getCurrentDate()
      
      // let url = `/api/v1/param?refresh_token=${this.token}&timer=${timer}&Type=2` ;
		  let url = `/api/v1/param?refresh_token=${this.token}&timer=${timer}&Param_1=1&Param_2=1&Param_3=1&Param_4=1&Param_5=1&Param_6=1&Param_7=1&Param_8=1&Param_11=1&Param_12=1&Param_21=1&Param_22=1&Param_23=1&Param_28=1&Param_29=1` ;
    
      this.$http.get(url).then((res) => {
        const data =  res.data.data.data
        const flattenedObject = data.reduce((acc, curr, index) => {
          Object.assign(acc, curr);
          return acc;
        }, {});
         this.quaryForm1 = flattenedObject
         this.quaryForm2 = flattenedObject
         this.quaryForm3 = flattenedObject
         this.quaryForm4 = flattenedObject
         this.quaryForm5 = flattenedObject
         this.quaryForm6 = flattenedObject
         this.quaryForm7 = flattenedObject
         this.quaryForm8 = flattenedObject
        this.quaryForm9 = flattenedObject
        this.info = flattenedObject
        uni.hideLoading();
      }).catch((error) => {
        console.log(error,'error');
         uni.showModal({
            title: "雷达暂未连接,请检查雷达状态",
            icon: "none",
            duration: 1000,
            showCancel:false
          })
          uni.hideLoading();
      }
          
      );
        
    },
    // 修改/应用雷达信息
    commitQuery(params, type, num) {
      this.paramsObj ={}
      this.num =num
      this.msg = type
      this.paramsObj = params
      this.modalName = 'DialogModal1'
     
    },
    //刷新
    flash() {
        if (!this.token) {
          uni.showModal({
            title: "雷达暂未连接,请检查雷达状态",
            icon: "none",
            duration: 1000,
            showCancel:false
          });
          uni.hideLoading();
          return
      }
      this.radarIP = uni.getStorageSync('radarIP')?uni.getStorageSync('radarIP'):'192.168.0.182'
      this.radarName = uni.getStorageSync('radarName')?uni.getStorageSync('radarName'):'雷达1'
      this.getDerviceMsg()
    },
    async sureChange() {
      const that = this
      that.modalName = null
      let timer = that.getCurrentDate()
      uni.showLoading({
				title: '加载中...',
				mask: true
      });
      // 初始化一个空数组，用于存储键值对的字符串表示形式
      var queryParams = [];
          // 遍历对象的每个键值对，并将它们转换成 "key=value" 的形式，然后添加到数组中
      for (var key in that.paramsObj) {
        if (that.paramsObj.hasOwnProperty(key)&& that.paramsObj[key] !=='') {
          // encodeURIComponent 用于对值进行 URL 编码，以防止特殊字符干扰 URL 结构
          queryParams.push(encodeURIComponent(key) + '=' + encodeURIComponent(that.paramsObj[key]));
        }
      }
      var queryString = queryParams.join('&');
      if (!that.token) {
        uni.showModal({
          title: "雷达暂未连接,请检查雷达状态",
          icon: "none",
          duration: 1000,
          showCancel:false
        });
         uni.hideLoading();
        return
      }
        let url = `/api/v1/message?refresh_token=${that.token}&Type=${that.num}&timer=${timer}&`+ queryString;
        await that.$http.post(url).then((res) => {
          if (res.data.code == 200) {
                if (this.num === 1) {
                 this.$router.push({
                    path: '/pages/index/index',
                    query: { value: 'home' }  // 传递的参数值
                 });
                  return
                }
                // 隐藏加载提示
                that.getDerviceMsg()
                that.$tip.success('应用成功')
                uni.hideLoading();
                 //设置经纬度 跳转首页更新站点坐标
              
            } else {
            }
        });
        },
        
  },
};
</script>

<style>
.uni-stat__select{
  width: 200px;
  
}
/deep/ .uni-select{
   height: 38px;
  margin-left: 0px !important;
  border: 1px solid #999 !important;
}
.cu-form-group1{
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: flex-start;
  font-size: 14px;
  align-items: center;
  padding: 15px;
}
.cu-form-group1 .title{
  min-width: 120px;
}
.setbtn_box{
  display: flex;
  width: 200px;
  margin-left: 20px;
  justify-content: space-around;
  align-items: center;
  flex-wrap: nowrap;

}
.cu-form-group1 .sure_btn1{
  height: 30px;
  width: 80px;
  font-size: 14px;
  line-height: 30px;
}
.s_box {
  min-width: calc(4em + 15px);
  display: flex;
  background-color: #fff;
  flex-direction: column;
  padding: 10px 15px;
  font-size: 16px;
  border-top: 1px solid #ccc;
  justify-content: space-between;
}
.title {
  font-weight: 700;
}
.btn_box{
  display: flex;
}
.sure_btn{
  height: 38px;
  width: 40%;
  line-height: 38px;
}
.sub_title{
  margin-right: 10px;
  text-align: left;
  line-height: 30px;
  min-width: 150px;

  /* width: 60%; */
}
.input1{
  border: 1px solid #999;
  height: 30px;
  /* width: 60%; */
  text-indent: 5px;
}
.content_box {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px;
}
.form{
  width: 100%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px;
}
.box2,.box1{
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
}
.form_item{
    width: 100%;
    margin: 8px 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px;
}
.text {
  color: #333;
}
.item {
  width: 38%;
  margin: 8px 0;
  display: flex;
  justify-content: space-between;
}
.open1{
  font-size: 20px;
  font-weight: 700;
  position: absolute;
  right: 20px;
}
</style>
